package com.example.chapter4;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.chapter4.util.DateUtil;


public class ActSendActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView tv_send;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_act_send);
        Button btn_send = findViewById(R.id.btn_send);
        tv_send = findViewById(R.id.tv_send);
        btn_send.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        // 创建一个意图对象，准备跳到指定的活动页面
        Intent intent = new Intent(this, ActReceiveActivity.class);
        Bundle bundle = new Bundle();  // 创建一个新包裹
        // 往包裹存入名为request_time的字符串
        bundle.putString("request_time", DateUtil.getNowTime());
        // 往包裹存入名为request_content的字符串
        bundle.putString("request_content", tv_send.getText().toString());
        intent.putExtras(bundle);  // 把快递包裹塞给意图
        startActivity(intent);  // 跳转到意图指定的活动页面
    }
}